import {
	request, streamRequest
} from "./request.js"

// 获取历史对话消息
export const chatHistoryList = (params, config = {}) =>
	request("/cms/aiDialogueRecord/getPageList", 'post', params, config, {
		//加载中开关
		loading: true,
		//相应错误提示开关
		toast: true,
		// 超时时间
		timeout: 60000
	});

//获取语音识别的token
export const chatAudioToken = (params, config = {}) =>
	request("/cms/aiDialogueHistory/getBaiduToken", 'post', params, config, {
		//加载中开关
		loading: true,
		//相应错误提示开关
		toast: true,
		// 超时时间
		timeout: 60000
	});

//清除chatGPT的上下文内容
export const chatClearMessage = (params, config = {}) =>
	request("/cms/aiDialogueHistory/delMessage", 'post', params, config, {
		//加载中开关
		loading: true,
		//相应错误提示开关
		toast: true,
		// 超时时间
		timeout: 60000
	});

// 获取打开一个新的对话的historyId
export const chatOpenNewHistory = (params, config = {}) =>
	request("/cms/aiDialogueHistory/add", 'post', params, config, {
		//加载中开关
		loading: true,
		//相应错误提示开关
		toast: true,
		// 超时时间
		timeout: 60000
	});


// 获取所有常问问题
export const chatGuessProblem = (params, config = {}) =>
	request("/digitalPortal/manage/problem/all", 'post', params, config, {
		//加载中开关
		loading: true,
		//相应错误提示开关
		toast: true,
		// 超时时间
		timeout: 60000
	});

// 对话列表
export const chatSessionList = (params, config = {}) =>
	request("/cms/aiDialogueHistory/getPageList", 'post', params, config, {
		//加载中开关
		loading: true,
		//相应错误提示开关
		toast: true,
		// 超时时间
		timeout: 60000
	});



// 新智能体列表
export const chatTechnologyList = (params, config = {}) =>
	request("/cms/aiAgent/list", 'post', params, config, {
		//加载中开关
		loading: true,
		//相应错误提示开关
		toast: true,
		// 超时时间
		timeout: 60000
	});

// 获取智能体列表详情
export const chatTechnologyDetail = (params, config = {}) =>
	request("/cms/aiAgent/detail", 'post', params, config, {
		//加载中开关
		loading: true,
		//相应错误提示开关
		toast: true,
		// 超时时间
		timeout: 60000
	});

// 获取默认智能体
export const getDefaultAgent = (params, config = {}) =>
	request("/cms/aiAgent/getDefaultAgent", 'post', params, config, {
		//加载中开关
		loading: true,
		//相应错误提示开关
		toast: true,
		// 超时时间
		timeout: 60000
	});

export const getInfo = (params, config = {}) =>
	request("/agentapi/getInfo", 'get', params, config, {
		//加载中开关
		loading: true,
		//相应错误提示开关
		toast: true,
		// 超时时间
		timeout: 60000
	});

export const published = (params, config = {}) =>
	request("/agentapi/agent/app/assistant/published", 'get', params, config, {
		//加载中开关
		loading: true,
		//相应错误提示开关
		toast: true,
		// 超时时间
		timeout: 60000
	});

export const assistant = (id, config = {}) =>
	request("/agentapi/agent/app/runningdetail/assistant/"+id, 'get', config, {
		//加载中开关
		loading: true,
		//相应错误提示开关
		toast: true,
		// 超时时间
		timeout: 60000
	});

export const chat = (params, config = {}) =>
	request("/agentapi/agent/aigc/chat/completions/sync", 'post', params, config, {
		//加载中开关
		loading: true,
		//相应错误提示开关
		toast: true,
		// 超时时间
		timeout: 60000
	});

export const messages = (params, config = {}) =>
	request("/agentapi/agent/aigc/chat/messages/"+params.dialogueHistoryNo, 'get', params.pagination, config, {
		//加载中开关
		loading: true,
		//相应错误提示开关
		toast: true,
		// 超时时间
		timeout: 60000
	});

export const addConversation = (id, config = {}) =>
	request("/agentapi/agent/app/addConversation/assistant/"+id, 'post', config, {
		//加载中开关
		loading: true,
		//相应错误提示开关
		toast: true,
		// 超时时间
		timeout: 60000
	});

export const login1 = (params, config = {}) =>
	request("/agentapi/login", 'post', params, config, {
		//加载中开关
		loading: true,
		//相应错误提示开关
		toast: true,
		// 超时时间
		timeout: 60000
	});

export const buttons = (id, config = {}) =>
	request("/agentapi/agent/app/assistant/getButtons/"+id, 'get', config, {
		//加载中开关
		loading: true,
		//相应错误提示开关
		toast: true,
		// 超时时间
		timeout: 60000
	});

export const deleteConversation = (id, config = {}) =>
	request("/agentapi/agent/app/deleteConversation/"+id, 'delete', config, {
		//加载中开关
		loading: true,
		//相应错误提示开关
		toast: true,
		// 超时时间
		timeout: 60000
	});

export const updateConversation = (params, config = {}) =>
	request("/agentapi/agent/app/renameConversation/"+params.id+'/'+params.name, 'post', config, {
		//加载中开关
		loading: true,
		//相应错误提示开关
		toast: true,
		// 超时时间
		timeout: 60000
	});

export const delete_message = (params, config = {}) =>
	request("/agentapi/agent/aigc/chat/messages/delete_message", 'post', params, config, {
		//加载中开关
		loading: true,
		//相应错误提示开关
		toast: true,
		// 超时时间
		timeout: 60000
	});